<?
/*----------------------------------------------------------------------
          (C) Bobtail-Bear 2006 	小飞熊新一代下载系统
          	代码编写：小飞熊	版权所有：小飞熊[L.F.Bear]
				官方网站/技术支持：http://www.lfbear.cn
------------------------------------------------------------------------
          (C) Bobtail-Bear 2006 	L.F.Bear's New Download Sysytem
          	Powered by L.F.Bear  Copyright L.F.Bear's Home(R)
               Official Web/Support：http://www.lfbear.cn
-----------------------------------------------------------------------*/

//本页脚本功能：免费下载转向页

ob_start();
session_start();
require("include/config.base.php");
require("include/config.inc.php");
require("function.php");
require_once("language/{$syslang}/function.php");

$id=$_GET[id];
$link=$_GET[link];
//判断来源是否存在问题
if(empty($id) || empty($link))
{
	$e_title=$f_lang[61];
	$e_msg=$f_lang[64];
	$e_link=$f_lang[62];
	require("error.php");
}
if(!file_exists($path_soft."/".$id.".php"))
{
	$e_title=$f_lang[61];
	$e_msg=$f_lang[65];
	$e_link=$f_lang[66];
	require("error.php");
}

if($safe=="y")
{
$cookie="r0a5n2d1_".$id;
$xx=$_COOKIE[$cookie];
$xxx=mimi();
$xxx=$xxx."_".$id;
if($xx!=$xxx)
{
	$e_title=$f_lang[61];
	$e_msg=$f_lang[63];
	$e_link=$f_lang[62];
	require("error.php");
}
}
$softinfo=readf($path_soft."/".$id.".php");
$softinfo=explode("|",$softinfo);
//偷个懒儿吧～
$info_num=array("qx"=>"24","p1"=>"26","v1"=>"27","o2"=>"28","p2"=>"30","v2"=>"31","o3"=>"32","p3"=>"34","v3"=>"35","o4"=>"36","p4"=>"38","v4"=>"39","o5"=>"40","p5"=>"42","v5"=>"43");
$username=$_SESSION[f_name];
if(ispopedom($softinfo[$info_num[qx]]))
switch($link)
{
case 1:
if ($softinfo[$info_num[v1]]<=0)   
{downplus($id,$path_soft);header ("Location:".$softinfo[$info_num[p1]]);}
else
{downplus($id,$path_soft);header ("Location:down.php?id=$id&link=1");}
break;
case 2:
if ($softinfo[$info_num[v2]]<=0)   
{downplus($id,$path_soft);header ("Location:".$softinfo[$info_num[p2]]);}
else
{downplus($id,$path_soft);header ("Location:down.php?id=$id&link=2");}
break;
case 3:
if ($softinfo[$info_num[v3]]<=0)   
{downplus($id,$path_soft);header ("Location:".$softinfo[$info_num[p3]]);}
else
{downplus($id,$path_soft);header ("Location:down.php?id=$id&link=3");}
break;
case 4:
if ($softinfo[$info_num[v4]]<=0)   
{downplus($id,$path_soft);header ("Location:".$softinfo[$info_num[p4]]);}
else
{downplus($id,$path_soft);header ("Location:down.php?id=$id&link=4");}
break;
case 5:
if ($softinfo[$info_num[v5]]<=0)   
{downplus($id,$path_soft);header ("Location:".$softinfo[$info_num[p5]]);}
else
{downplus($id,$path_soft);header ("Location:down.php?id=$id&link=5");}
break;
}
ob_end_flush(); 
?>